// mch/verify/verify.js
Page({
    data: {
        list: [],
      card: [{
        logo: "../images/1.jpg",
        name: "剩余次数：30",
        valid:"有效期至:2020-04-16 15:22:44",
        discounts: "7.5折优惠购物卡"
      }, {
        logo: "../images/1.jpg",
        name: "河南奔驰4S店",
        discounts: "洗车卡"
      }, {
        logo: "../images/1.jpg",
        name: "河南奔驰4S店",
        discounts: "洗车卡"
      }, {
        logo: "../images/1.jpg",
        name: "河南奔驰4S店",
        discounts: "洗车卡"
      }, {
        logo: "../images/1.jpg",
        name: "河南奔驰4S店",
        discounts: "洗车卡"
      }, {
        logo: "../images/1.jpg",
        name: "河南奔驰4S店",
        discounts: "洗车卡"
      }]
    },
    onLoad: function(t) {
        getApp().page.onLoad(this, t), this.setData({
            status: t.status || 0
        }), this.loadData(t);
    },
    loadData: function(t) {
      /**
       * 有效卡数量
       * 
       * 核销卡id
       * 核销卡名称
       * 剩余次数
       * 有效期
       */
        var a = this;
        getApp().core.showLoading({
            title: "加载中"
        }), getApp().request({
            url: getApp().api.verify.index,
            data: {
                status: 0
            },
            success: function(t) {
              // console.log(t.data);
              // console.log('sss');
                0 == t.code && a.setData({
                    num:t.data.num,
                    list: t.data.list
                });
            },
            complete: function() {
                getApp().core.hideLoading();
            }
        });
    },
    goodsList: function(t) {
        var a = t.currentTarget.dataset.goods_id, s = t.currentTarget.dataset.id, e = this.data.list;
        for (var i in e) if (parseInt(e[i].user_coupon_id) === parseInt(s)) return void (2 == e[i].appoint_type && 0 < e[i].goods.length && getApp().core.navigateTo({
            url: "/pages/list/list?goods_id=" + a
        }));
    },
    xia: function(t) {
        var a = t.target.dataset.index;
        this.setData({
            check: a
        });
    },
    shou: function() {
        this.setData({
            check: -1
        });
    },
    open_verify_detail:function(e){
      var s = e.currentTarget.dataset.id;
      getApp().core.navigateTo({          url:"/mch/verify-detail/verify-detail?id=" +s });


  }

});